package cn.itlaobing.web.service;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import cn.itlaobing.web.dao.ListDao;
import cn.itlaobing.web.exception.MyeEXception;
import cn.itlaobing.web.model.ListModel;

public class ListService {
	private ListDao ld=new ListDao();
	public List<ListModel> queryOne(Integer userid) throws MyeEXception{
		List<ListModel> list;
		try {
			list=ld.queryOne(userid);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new MyeEXception(e.getMessage());
		} catch (IOException e) {
			e.printStackTrace();
			throw new MyeEXception(e.getMessage());
		}finally {
			try {
				ld.close();
			} catch (SQLException e) {
				e.printStackTrace();
				throw new MyeEXception(e.getMessage());
			}
		}
		return list;
	}
	public int updateOne(String attitude,String listid) throws MyeEXception {
		int row=0;
		try {
			row=ld.updateOne(attitude,listid);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new MyeEXception(e.getMessage());
		} catch (IOException e) {
			e.printStackTrace();
			throw new MyeEXception(e.getMessage());
		}finally {
			try {
				ld.close();
			} catch (SQLException e) {
				e.printStackTrace();
				throw new MyeEXception(e.getMessage());
			}
		}
		return row;
	}
}
